{% extends "djstripe/admin/change_form.html" %}
{% load i18n %}
{% load static %}

{% block object-tools-items %}
    {{ block.super }}
    {% with original.get_stripe_dashboard_url as stripe_url %}
        {% if stripe_url %}
            <li>
                <a href="{% url 'payment-intent-refund' pk=original.pk %}" rel="refund-modal:open"
                   class="djstripe-payment-refund-cta">{% trans "Refund" %}
                </a>
            </li>
        {% endif %}
    {% endwith %}
{% endblock %}

{% block admin_change_form_document_ready %}
    {{ block.super }}
    <script src="{% static 'djstripe/refund.js' %}"></script>
{% endblock %}